import Router from 'vue-router'
Vue.use(Router)


// 解决编程式路由往同一地址跳转时会报错的情况
const originalPush = Router.prototype.push;
const originalReplace = Router.prototype.replace;

// push
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalPush.call(this, location, onResolve, onReject);
  return originalPush.call(this, location).catch(err => err);
};

//replace
Router.prototype.replace = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalReplace.call(this, location, onResolve, onReject);
  return originalReplace.call(this, location).catch(err => err);
};


export default new Router({
	mode: 'history',
	base: '/houtai',

	routes: [
    {
      path: '/',
      redirect:'/game'
    },

    {
        path: '/login',
        component: () => import('@/esports/denglu/index'),
        mete:{
          title:"注册登录",
        }
    },

    {
    	path: '/game',
      component: () => import('@/esports/game/index'),
      redirect:'/game/game',
      children:[
        {
          path: '/game/game',
          component: () => import('@/esports/game/lanmu'),
          mete:{
            title:"游戏管理",
          },
        }
      ]
    },

    {
    	path: '/dingdan',
      component: () => import('@/esports/dingdan/index'),
      redirect:'/dingdan/dingdan',
      children:[
        {
          path: '/dingdan/dingdan',
          component: () => import('@/esports/dingdan/list'),
          mete:{
            title:"订单列表",
          },
        }
      ]
    },
    {
    	path: '/shouyi',
      component: () => import('@/esports/shouyi/index'),
      redirect:'/shouyi/shouyi',
      children:[
        {
          path: '/shouyi/shouyi',
          component: () => import('@/esports/shouyi/list'),
          mete:{
            title:"收益管理",
          },
        }
      ]
    },
    {
    	path: '/tixian',
      component: () => import('@/esports/tixian/index'),
      redirect:'/tixian/tixian',
      children:[
        {
          path: '/tixian/tixian',
          component: () => import('@/esports/tixian/list'),
          mete:{
            title:"提现管理",
          },
        }
      ]
    },
    {
    	path: '/yaoqing',
      component: () => import('@/esports/yaoqing/index'),
      redirect:'/yaoqing/yaoqing',
      children:[
        {
          path: '/yaoqing/yaoqing',
          component: () => import('@/esports/yaoqing/list'),
          mete:{
            title:"分销统计",
          },
        }
      ]
    },

    {
    	path: '/renyuan',
      component: () => import('@/esports/renyuan/index'),
      redirect:'/renyuan/renyuan',
      children:[
        {
          path: '/renyuan/renyuan',
          component: () => import('@/esports/renyuan/list'),
          mete:{
            title:"人员列表",
          },
        }
      ]
    },
    {
    	path: '/peizhi',
      component: () => import('@/esports/peizhi/index'),
      redirect:'/peizhi/peizhi',
      children:[
        {
          path: '/peizhi/peizhi',
          component: () => import('@/esports/peizhi/list'),
          mete:{
            title:"配置",
          },
        }
      ]
    },

	]
})
